{{!

  Copyright (c) Meta Platforms, Inc. and affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

}}
namespace {{service:qualified_namespace}} {
class {{service:cpp_name}};
} // namespace {{service:qualified_namespace}}
namespace apache::thrift {

namespace detail {

template<>
struct ServiceMethodTypesFootprint<{{service:qualified_name}}> {
  // The types that appear in the definitions of service methods.
  // e.g. if it appears as a type of an input, output, exception sink or stream
  // parameter of a client stub, it appears here,
  using TypesInMethods = folly::tag_t<{{#each
  (array.enumerate service:self.user_type_footprint with_last=true)
  as |index type last?|}}
  {{type.cpp_type}}{{#if (not last?)}},{{/if}}{{/each}}>;
};
} // namespace detail

template <>
class Client<{{service:qualified_name}}> : public {{#service:extends}}::{{service:qualified_namespace}}::{{service:cpp_name}}AsyncClient{{/service:extends}}{{^service:extends}}apache::thrift::GeneratedAsyncClient{{/service:extends}} {
  static_assert(!folly::is_detected_v<::apache::thrift::detail::st::detect_complete, {{service:qualified_name}}>, "Definition collision with service tag. Either rename the Thrift service using @cpp.Name annotation or rename the conflicting C++ type.");
 public:
  using {{#service:extends}}::{{service:qualified_namespace}}::{{service:cpp_name}}AsyncClient::{{service:cpp_name}}AsyncClient{{/service:extends}}{{^service:extends}}apache::thrift::GeneratedAsyncClient::GeneratedAsyncClient{{/service:extends}};

  std::string_view getServiceName() const noexcept override {
    return "{{service:parent_service_name}}";
  }
{{#service:uri}}

  static constexpr folly::cstring_view __fbthrift_thrift_uri = "{{service:uri}}";
{{/service:uri}}

{{#service:interactions}}
{{> service_h/interaction_async_client}}
{{/service:interactions}}

{{> service_h/async_client_functions}}
};

} // namespace apache::thrift

namespace {{service:qualified_namespace}} {
using {{service:cpp_name}}AsyncClient [[deprecated("Use apache::thrift::Client<{{service:cpp_name}}> instead")]] = ::apache::thrift::Client<{{service:cpp_name}}>;
} // namespace {{service:qualified_namespace}}
